package com.arron.algorithm.leetcodetop100.贪心;

public class 跳跃游戏 {

    public boolean canJump(int[] nums) {

        int maxJump = 0;
        for (int i = 0; i < nums.length; i++) {

            //每次记录下之前能跳到这里的最大值
            if (i <= maxJump ){
                maxJump = Math.max(i+nums[i],maxJump);
            }
        }

        return maxJump >= nums.length-1;
    }

}
